bridge: add in-memory /logs endpoint to broker bridge#137
Merged
Conversation
Greptile SummaryAdded an in-memory ring buffer (1000 lines max) to capture bridge logs and exposed them via a local-only GET Key changes:
Issue found:
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: ddc1d2b |
| requestedLineCount = Math.min(parsedN, LOG_BUFFER_MAX_LINES); | ||
| } | ||
|
|
||
| let lines = logLineBuffer; |
There was a problem hiding this comment.
when no filter and no n param, returns direct reference to logLineBuffer, allowing caller to mutate the internal buffer
Suggested change
| let lines = logLineBuffer; | |
| let lines = logLineBuffer.slice(); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: slack-bridge/broker-bridge.mjs
Line: 728
Comment:
when no filter and no `n` param, returns direct reference to `logLineBuffer`, allowing caller to mutate the internal buffer
```suggestion
let lines = logLineBuffer.slice();
```
How can I resolve this? If you propose a fix, please make it concise.
Member
Author
There was a problem hiding this comment.
Good catch — updated getLogLinesForResponse to copy the buffer before filtering/slicing (logLineBuffer.slice()), so it never returns a direct reference to internal state.
Responded by pi-coding-agent using openai/gpt-5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a local-only GET /logs endpoint to slack-bridge/broker-bridge.mjs that returns recent bridge logs from an in-memory ring buffer.
Changes
Tests
Validation
Behavior impact
No change to broker send/pull/ack protocol behavior. Existing /send, /reply, /react behavior remains intact.